package aos.client.robot;
import org.apache.log4j.Logger;

import aos.client.skype.SkypeClient;
import aos.server.robot.RobotControllerProxy;

public class RemoteRobotControllerProxy  implements RobotControllerProxy {
	
	Logger logger = Logger.getLogger(RemoteRobotControllerProxy.class);
	
	SkypeClient skypeClient;
	
	double x = -1.0;
	double y = -1.0;
	
	public RemoteRobotControllerProxy() {
		skypeClient = new SkypeClient();
		logger.info("Skype client initialized.");
	}
	
	@Override
	public void setPosition(double x, double y) {
		if (this.x != x || this.y != y) {
			this.x = x;
			this.y = y;
			updatePosition();
		}
	}
	
	private void updatePosition(){
		logger.info("Update position x: " + this.x + "; y: " + this.y);
		skypeClient.writeData(this.x + "," + this.y);
	}

}
